<template>
  <div class="dialog-container">
    <div class="dialog-content">
      <el-form size="mini" label-width="120px">
        <el-form-item label="拍卖名称:">
          <div class="item-content">{{ info.title }}</div>
        </el-form-item>
        <el-form-item label="公司名称:">
          <div class="item-content">{{ info.company_name }}</div>
        </el-form-item>
        <el-form-item label="物资分类:">
          <div class="item-content">{{ selectedCateList }}</div>
        </el-form-item>
        <el-form-item label="联系电话:">
          <div class="item-content">{{ info.user_phone }}</div>
        </el-form-item>
        <el-form-item label="报名截止时间:">
          <div class="item-content">{{ info.apply_end_time }}</div>
        </el-form-item>
        <el-form-item label="拍卖招标时间:">
          <div class="item-content">{{ info.sell_time }}</div>
        </el-form-item>
        <el-form-item label="保证金:">
          <div class="item-content">{{ info.promise_price }}{{ showMsg(promiseUnitList, info.promise_unit) }}</div>
        </el-form-item>
        <el-form-item label="所属地区:">
          <div class="item-content">{{ selectedAreaList }}</div>
        </el-form-item>
        <el-form-item style="margin-bottom: 0; margin-top: 40px">
          <div class="panel-line flex-end">
            <el-button @click="onCancel">取消</el-button>
            <el-button type="primary" @click="onSubmit">确认</el-button>
          </div>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DialogConfirm',
  props: {
    info: {
      type: Object,
      default: () => {
        return {}
      },
    },
    promiseUnitList: Array,
    selectedAreaList: String,
    selectedCateList: String,
  },
  data() {
    return {}
  },
  mounted() {},
  destroyed() {},
  methods: {
    showMsg(list, val, labelName, valueName) {
      if (!labelName) {
        labelName = 'label'
      }
      if (!valueName) {
        valueName = 'value'
      }
      const item = list.find((item) => item[valueName] === val)
      if (item) {
        return item[labelName]
      } else {
        return ''
      }
    },
    // 取消
    onCancel() {
      this.$emit('close')
    },
    // 立即申领
    onSubmit() {
      this.$emit('confirm')
    },
  },
}
</script>

<style scoped lang="scss">
.el-form-item {
  margin-bottom: 5px;
}
</style>
